<form class="form-horizontal form-modal" method="post" enctype="multipart/form-data" id="editForm">
    <input type="text" value="{$system_id}" name="system_id" hidden>

    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
                        class="sr-only">Close</span></button>
                <h4 class="modal-title">编辑权限规则</h4>
            </div>

            <div class="modal-body">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="form-group row">
                            <label class="col-sm-2 col-form-label">菜单节点 ：</label>
                            <div class="col-sm-10">
                                <label class="lab-radio">
                                    <input type="radio" value="1"
                                           name="is_menu" {if $info->is_menu == '1'} checked="" {/if}>是
                                </label>
                                <label class="lab-radio">
                                    <input type="radio" value="0" name="is_menu" {if $info->is_menu == '0'} checked=""
                                    {/if}>否
                                </label>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group row">
                            <label class="col-sm-2 col-form-label">父级 ：</label>
                            <div class="col-sm-10">
                                <select class="chosen-select form-control" name="parent_id">
                                    <option value="0">请选择父级规则</option>
                                    {foreach $list as $item}
                                    <option value="{$item->id}" {if $item->id == $info->parent_id} selected
                                        {/if}>{$item->level_name | raw}
                                    </option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group row">
                            <label class="col-sm-2 col-form-label">权限名称 ：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="name" value="{$info->name}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group row">
                            <label class="col-sm-2 col-form-label">权限路由 ：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="route" value="{$info->route}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group row">
                            <label class="col-sm-2 col-form-label">访问方式 ：</label>
                            <div class="col-sm-10">
                                <select class="form-control" name="route_mode">
                                    <option value="GET">GET</option>
                                    <option value="POST">POST</option>
                                    <option value="DELETE">DELETE</option>
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group row">
                            <label class="col-sm-2 col-form-label">菜单图标 ：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="icon" value="{$info->icon}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group row">
                            <label class="col-sm-2 col-form-label">备注 ：</label>
                            <div class="col-sm-10">
                                <textarea class="form-control" name="remark">{$info->remark}</textarea>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>


                        <div class="form-group row">
                            <label class="col-sm-2 col-form-label">状态 ：</label>
                            <div class="col-sm-10">
                                <label class="lab-radio">
                                    <input type="radio" value="1"
                                           name="status" {if $info->status == '1'} checked {/if}>显示
                                </label>
                                <label class="lab-radio">
                                    <input type="radio" value="0" name="status"
                                           {if $info->status == '0'} checked {/if}>隐藏
                                </label>
                            </div>
                        </div>

                    </div>
                </div>
            </div>

            <div class="modal-footer">
                <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary"
                        onclick="post_form($(this),'{$Think.config.admin.app_host}/admin/rule/{$info->id}')">保存
                </button>
            </div>
        </div>
    </div>
</form>

<script>
    $(function () {
        $('.chosen-select').chosen({width: "100%", search_contains: true,});
        let route_mode = '{$info->route_mode}';
        if (route_mode) {
            $("select[name='route_mode']").find("option:contains('" + route_mode + "')").attr("selected", true)
        }
    })
</script>